package ru.ssau.customerManagement.model.entities;

import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;

/**
 * Author: illabefat
 * Time: 02.11.2014
 */
@XmlRootElement(name="customerLocation")
public class CustomerLocation implements Serializable{
    private static final long serialVersionUID = -7244701227796930714L;

    private Long id;
    private Long customerId;
    private String address;

    public CustomerLocation(){}
    public CustomerLocation(Long id, Long customerId) {
        this(id, customerId, "");
    }

    public CustomerLocation(Long id, Long customerId, String address) {
        this.id = id;
        this.customerId = customerId;
        this.address = address;
    }

    @XmlAttribute
    public Long getId() {
        return id;
    }
    public void setId(Long id) {this.id=id; }

    @XmlElement
    public Long getCustomerId() {
        return customerId;
    }
    public void setCustomerId(Long customerId) {this.customerId=customerId; }

    @XmlAttribute
    public String getAddress() {
        return address;
    }
    public void setAddress(String address) {
        this.address = address;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof CustomerLocation)) return false;

        CustomerLocation that = (CustomerLocation) o;

        if (!id.equals(that.id)) return false;

        return true;
    }

    @Override
    public int hashCode() {
        return id.hashCode();
    }
}
